oo::class create MicroUndo {
    superclass Plugin
    variable RenamedPadWidget SuspendFlag

    constructor {renamedPadWidget} {
        set RenamedPadWidget $renamedPadWidget
        $RenamedPadWidget configure -undo 1 -autoseparators 0 -maxundo 0
        set SuspendFlag 0
    }

    method ifSuspend? {} {
        return [expr $SuspendFlag == 1]
    }

    method suspend {} {
        set SuspendFlag 1
    }

    method resume {} {
        set SuspendFlag 0
    }

    method setSeparator {args} {
        if ![my ifSuspend?] {
            $RenamedPadWidget edit separator
        }
    }

    method getPluginEvents {} {
        return {
            {afterInsert setSeparator}
            {afterDelete setSeparator}
            {afterReplace setSeparator}
        }
    }
}